<template>
	<view class="cu-chat">
		<web-view class="detail-webview" :style="{height:webHeight+'px', width: '750rpx',top:CustomBar+'px' }" :src="chat_url">
		</web-view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				chat_url: '', //h5链接
				CustomBar: this.CustomBar,
				webHeight:'',//高度
			}
		},

		/**
		 * @description 页面入参
		 * @param {object} options = [kid,goods_id,activity_id]
		 * @param {string} kid = 客服id
		 * @param {string} goods_id = 商品id
		 * @param {string} activity_id = 活动id
		 */
		onLoad(option) {
			if(option.order_sn){
				this.chat_url = option.chat_url+'?token='+option.token+'&goods_id='+option.goods_id+'&order_sn='+option.order_sn
			}else{
				this.chat_url = option.chat_url+'?token='+option.token+'&goods_id='+option.goods_id
			}
			console.log(option,this.chat_url,'this.chat_url');
			uni.getSystemInfo({
				success: e => {
					console.log(e, 'e============')
					this.webHeight = e.windowHeight - this.CustomBar;
					console.log(this.webHeight,'this.webHeight');
				}
			});
		},

		methods: {
			goCall() {
				// console.log(this.$store.state.userInfo.phone);
				let phone = String(this.$store.state.userInfo.phone);
				uni.makePhoneCall({
					phoneNumber: phone,
					fail(err) {
						console.log(err);
					}
				});
			}

		}
	};
</script>

<style lang="scss" scoped>
	.cu-chat {
		height: 100vh;
	}

	.detail-webview {
		width: 750rpx;
		height: 98vh;
	}

	.call-img {
		width: 40rpx;
		height: 40rpx;
	}
</style>
